#ifndef _SYNTH_H_
#define _SYNTH_H_

template
<
    typename SignalSystem,
    template <class> class Iterator,
    typename Decision
>
class Synth
{
public:

    Synth(const SignalSystem& sys)
    {
        it = Iterator<SignalSystem>(sys);
    }
    
    SignalSystem operator()()
    {
        while (it.next())
        {
            if (!decision(*it.current()))
            {
                it.prev();
                continue;
            }
        }
        
        return *it.current();
    }
    
private:

    Decision decision;
    
    Iterator<SignalSystem> it;
};

#endif // _SYNTH_H_
